import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Listen implements ActionListener {
    Win win;
    public void setWin(Win win){
        this.win = win;
    }

    public void actionPerformed(ActionEvent e){
        double a = Double.parseDouble(win.text1.getText().trim());
        double b = Double.parseDouble(win.text2.getText().trim());
        double c = Double.parseDouble(win.text3.getText().trim());
        win.tri = new Triangle(a, b, c);
        if(win.tri.isTri()){
            double area = win.tri.calArea();
            String s = String.format("面积：\n%.3f\n", area);
            win.area.append(s);
        }else{
            win.area.append("无法构成三角形\n");
        }
    }
}